package org.footballmanager.pandafootball.system.domain;

import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.footballmanager.pandafootball.common.util.DateFormatUtil;

import javax.persistence.*;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;

/**
 * 留言表
 */
@Entity
@Setter
@Getter
@ToString
public class FootLy extends BaseEntity implements Serializable {
    @Column(name = "sender")
    private Long sender;
    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "send_time", length = 19)
    private Date sendTime;
    @Column(name = "content")
    @NotNull
    private String content;
    @Transient
    private Double money = 0D;
    @Transient
    private Long whiteChip = 0L;
    @Transient
    private Long greenChip = 0L;
    @Transient
    private Long blueChip = 0L;
    @Transient
    private Long purpleChip = 0L;
    @Transient
    private Long orangeChip = 0L;
    @Transient
    private String sendTimeStr;

    public String getSendTimeStr() {
        if (getSendTime() != null) {
            return DateFormatUtil.fromToday(getSendTime());
        }
        return "好久好久以前";
    }
}